<?

require_once("com/borderwaitmaps/entities/City.php");

class CityParser
{
	
	private $city;
	
	/**
	 * Parses JSON data to/from a City
	 */
	public function CityParser()
	{
		$this->city = new City();		
	}
	
	public function unmarshall($data)
	{
		$this->city->setId ( $data->id );
		$this->city->setName( $data->name );
		//TODO: geocoding
		return $this->city;
	}
	
	public function marshall( $city )
	{
		// output as json
		$data;
		$data->class = "City";
		$data->id = $city->getId();
		$data->name = $city->getName();
		return ( $data );
	}
	
}


?>